"use strict";
(function($) {
"use strict";
$(window).on("scroll", function() {
var scrolltop = $(window).scrollTop();
if ($(document).width() < 992) {
return;
}
if (scrolltop > 300) {
$(".navbar-sticky").addClass("fixed-top");
} else {
$(".navbar-sticky").removeClass("fixed-top");
}
});
$(".navbar-nav")
.find(".dropdown-toggle")
.on("click", function() {
if ($(document).width() > 992) {
return;
}
$(this)
.siblings(".dropdown-menu")
.slideToggle();
});
$(".nav-search").on("click", function() {
$(this)
.siblings(".search-block")
.slideToggle();
});
$(window).on("load", function() {
setTimeout(function() {
$(".sassico-preloder").slideUp(800);
}, 1000);
});
// back to top
$(window).on("scroll", function() {
var scrolltop = $(window).scrollTop(),
docHeight = $(document).height() / 2;
if (scrolltop > docHeight) {
$(".back_to_top, .sassico-back-to-top-wraper").fadeIn("slow");
} else {
$(".back_to_top, .sassico-back-to-top-wraper").fadeOut("slow");
}
});
$("body, html").on("click", ".back_to_top, .sassico-back-to-top", function(
e
) {
e.preventDefault();
$("html, body").animate(
{
scrollTop: 0
},
800
);
});
$.fn.max = function(selector) {
return Math.max.apply(
null,
this.map(function(index, el) {
return selector.apply(el);
}).get()
);
};
$(".swiper-container-vertical")
.find(".testimonial___slider")
.each(function() {
var maxHeight = $(this)
.find(".testimonial-content")
.max(function() {
return $(this).outerHeight();
});
$(this).css("max-height", maxHeight);
console.log(maxHeight);
});
$(".xs_text_ellipsis")
.find(".wfp-campaign-content--title__link")
.each(function(i, element) {
let content = $(element)
.text()
.split(/\s+/),
last_part = content.pop(),
first_part = content.join(" ");
$(element).html(
[
first_part + ' ' + last_part + ""
].join(" ")
);
});
$(".header").each(function() {
$(this)
.find(".menu-item-has-children")
.children("a")
.append('');
});
})(jQuery);